//
//  HttpAssottManager.m
//  Cat
//
//  Created by lushitong on 2018/12/19.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "HttpAssottManager.h"
#import "FLRequest.h"
#import "FLTool.h"
#import "HttpAssortPtl.h"
#import "AssortCategroyModel.h"
#import "HomePriorityInfo.h"

@implementation HttpAssottManager

+ (void)getCategoryListWithSuccess:(void (^)(AssortCategroyModel *))success failure:(FLFailure)failure {
	[HttpAssortPtl getCategoryListWithSuccuss:^(NSDictionary * _Nonnull dict) {
		NSArray *array = [NSArray yy_modelArrayWithClass:[CategoryInfo class] json:dict];
		AssortCategroyModel *mode = [[AssortCategroyModel alloc] init];
		mode.categoryList = array;
		if (success) {
			success(mode);
		}
	} failure:failure];
}

+ (void)getCategoryListWithProductListWithCategoryID:(NSNumber *)categoryID WithSuccess:(void (^)(AssortCategroyModel *assort))success failure:(FLFailure)failure; {
	[HttpAssortPtl getCategoryListWithProductListWithCategoryID:categoryID WithSuccuss:^(NSDictionary * _Nonnull dict) {
		NSArray *array = [NSArray yy_modelArrayWithClass:[CategoryInfo class] json:dict];
		AssortCategroyModel *mode = [[AssortCategroyModel alloc] init];
		mode.categoryList = array;
		if (success) {
			success(mode);
		}
	} failure:failure];
}

+ (void)getCategoryProductListWithCategoryID:(NSNumber *)categoryID
								andPageIndex:(NSNumber *)pageIndex
								 andSortType:(NSString *)sortType
								 withSuccess:(void (^)(NSArray *))success
									 failure:(FLFailure)failure {
	
	[HttpAssortPtl getCategoryProductListWithCategoryID:categoryID andPageIndex:pageIndex andSortType:sortType withSuccuss:^(NSDictionary *dict) {
		NSArray *array = [NSArray yy_modelArrayWithClass:[GroomsModel class] json:dict];
		if (success) {
			success(array);
		}
	} failure:^(NSInteger code, NSString * _Nonnull message) {
		
	}];
}
@end
